From: Jonas Dreßler Date: Fri, 3 May 2019 20:56:02 +0000 (+0200) Subject: windowManager: Fix fullscreen windows in ws switching animations X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~845^2^2~226 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=4e6b2eb72a0920c534845fe789dfeecd0cb90295;p=gnome-shell.git windowManager: Fix fullscreen windows in ws switching animations To prevent a small gap between windows in the workspace switching animation, we temporarily shift windows up or down by the height of the panel. This obviously breaks the animation for fullscreen windows, those will overlap with the ones on the other workspace since there is no panel shown in that case. Fix this by checking whether the old or new workspace includes a fullscreen window and don't shift the windows if there is one. Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/757 https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/322 --- diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index b9f5fef46..e80cfd483 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -1870,17 +1870,25 @@ var WindowManager = class { } } - _getPositionForDirection(direction) { + _getPositionForDirection(direction, fromWs, toWs) { let xDest = 0, yDest = 0; + let oldWsIsFullscreen = fromWs.list_windows().some(w => w.is_fullscreen()); + let newWsIsFullscreen = toWs.list_windows().some(w => w.is_fullscreen()); + + // We have to shift windows up or down by the height of the panel to prevent having a + // visible gap between the windows while switching workspaces. Since fullscreen windows + // hide the panel, they don't need to be shifted up or down. + let shiftHeight = Main.panel.height; + if (direction == Meta.MotionDirection.UP || direction == Meta.MotionDirection.UP_LEFT || direction == Meta.MotionDirection.UP_RIGHT) - yDest = -global.screen_height + Main.panel.height; + yDest = -global.screen_height + (oldWsIsFullscreen ? 0 : shiftHeight); else if (direction == Meta.MotionDirection.DOWN || direction == Meta.MotionDirection.DOWN_LEFT || direction == Meta.MotionDirection.DOWN_RIGHT) - yDest = global.screen_height - Main.panel.height; + yDest = global.screen_height - (newWsIsFullscreen ? 0 : shiftHeight); if (direction == Meta.MotionDirection.LEFT || direction == Meta.MotionDirection.UP_LEFT || @@ -1938,7 +1946,7 @@ var WindowManager = class { switchData.container.add_actor(info.actor); info.actor.raise_top(); - let [x, y] = this._getPositionForDirection(dir); + let [x, y] = this._getPositionForDirection(dir, curWs, ws); info.actor.set_position(x, y); } @@ -2024,7 +2032,11 @@ var WindowManager = class { this._switchData.inProgress = true; - let [xDest, yDest] = this._getPositionForDirection(direction); + let workspaceManager = global.workspace_manager; + let fromWs = workspaceManager.get_workspace_by_index(from); + let toWs = workspaceManager.get_workspace_by_index(to); + + let [xDest, yDest] = this._getPositionForDirection(direction, fromWs, toWs); /* @direction is the direction that the "camera" moves, so the * screen contents have to move one screen's worth in the